package com.wr.common.datasource.domain;


import cn.mybatis.mp.db.annotations.LogicDelete;
import cn.mybatis.mp.db.annotations.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Size;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import java.io.Serializable;
import java.util.Date;

/**
 * @author MyPC
 */
@Data
public class BaseEntity implements Serializable {

    /**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
    @TableField(defaultValue = "{NOW}")
    private Date createTime;
    /**
     * 创建者
     */
    @Size(max = 32, message = "编码长度不能超过32")
    @Length(max = 32, message = "编码长度不能超过32")
    private String createBy;
    /**
     * 修改时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
    @TableField(updateDefaultValue ="{NOW}")
    private Date updateTime;
    /**
     * 修改者
     */
    @Size(max = 32, message = "编码长度不能超过32")
    @Length(max = 32, message = "编码长度不能超过32")
    private String updateBy;
    /**
     * 备注
     */
    @Size(max = 100, message = "编码长度不能超过100")
    @Length(max = 100, message = "编码长度不能超过100")
    @Schema(description = "备注")
    private String remark;

    @LogicDelete
    private String deleted;
}
